package com.vf.admin.client.dao;

import com.vf.admin.common.db.BaseDao;
import com.vf.admin.miaodong.entity.AppUser;
import com.vf.admin.miaodong.entity.PaySelect;
import com.vf.admin.miaodong.entity.PhpUser;
import com.vf.admin.miaodong.entity.PopupLog;
import org.springframework.stereotype.Repository;

import java.util.ArrayList;
import java.util.List;

/**
 * <p>Title : </p>
 * <p>Description : </p>
 * <p>DevelopTools : IDEA</p>
 * <p>DevelopSystem : Windows11</p>
 *
 * @Author : zxw
 * @Date 2023/10/21 17:19
 */
@Repository
public class PhpUserDao extends BaseDao<PhpUser> {


    public PhpUser getType(Integer userId, Integer type) {

        List<Object> paramList = new ArrayList<Object>();
        StringBuilder sbStr = new StringBuilder("");
        sbStr.append("select * from php_user where userid = ? and type = ?");
        paramList.add(userId);
        paramList.add(type);
        String sql = sbStr.toString();
        return this.queryObj(sql, paramList, PhpUser.class);
    }

    public void save(PhpUser phpUser) {
        if (phpUser.getId() != null && phpUser.getId() > 0) {
            this.update(phpUser);
        } else {
            phpUser.setId(this.add(phpUser));
        }
    }

    public PhpUser getInfo(Integer id,Integer type) {

        ArrayList<Object> paramList = new ArrayList<>();
        StringBuilder sbStr = new StringBuilder("select * from php_user where userid= "+ id +" and type = "+ type);
        String sql = sbStr.toString();
        return this.queryObj(sql, paramList, PhpUser.class);
    }
}
